@import './variables.scss';

#app {
  .main-container {
    transition: margin-left .28s;
    margin-left: $sideBarWidth;
    height: calc(100vh - 6rem);
  }
  .mt-list-footer.fixed {
    left: $sideBarWidth;
    // width: calc(100% - $sideBarWidth);
  }
  .sidebar-container {
    width: $sideBarWidth;
    // reset element-ui css
    .horizontal-collapse-transition {
      transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
    }

    .scrollbar-wrapper {
      overflow-x: hidden !important;
      // 菜单栏顶部间距
      padding-top: 14px;
    }

    .el-scrollbar__bar.is-vertical {
      right: 0px;
    }

    .el-scrollbar {
      height: calc(100% - 1.4rem);
    }

    &.has-logo {
      .el-scrollbar {
        height: calc(100% - 50px);
      }
    }

    .is-horizontal {
      display: none;
    }

    a {
      display: inline-block;
      width: 100%;
      overflow: hidden;
    }

    .svg-icon {
      margin-right: 8px;
      font-size: 20px;
      margin-bottom: -3px;
    }

    .el-menu {
      border: none;
      height: 100%;
      width: 100% !important;
      // 二级菜单触发一级菜单样式变化
      .active {
        .el-submenu__title {
          color: #4d9bd5 !important;
        }
      }
    }
    // menu hover
    .submenu-title-noDropdown,
    .el-submenu__title {
      // 修改一级菜单高度
      height: 34px;
      line-height: 34px;
      margin: 0.5rem 1.5rem;
      border-radius: 4px;
      .el-submenu__icon-arrow {
        transform: rotate(-90deg);
      }

      &:hover {
        background-color: $menuHover !important;
      }
    }
    // 菜单箭头转向方向
    .el-submenu.is-opened>.el-submenu__title .el-submenu__icon-arrow {
      transform: rotate(0deg);
    }
    .el-menu-item {
      margin: .5rem 1.5rem;
      border-radius: 4px;
      // 修改二级菜单样式
      height: 34px;
      line-height: 34px;
    }

    // 菜单激活时的背景色
    .el-menu-item.is-active {
      background-color: $menuHover !important;
    }

    .is-active>.el-submenu__title {
      // color: $subMenuActiveText !important;
    }

    & .nest-menu .el-submenu>.el-submenu__title,
    & .el-submenu .el-menu-item {
      // min-width: $sideBarWidth !important;
      margin-left: 22px;
      &:hover {
        background-color: $subMenuHover !important;
      }
    }
  }

  .hideSidebar {
    .mt-list-footer.fixed {
      left: 54px!important;
      // width: calc(100% - $sideBarWidth);
    }
    .sidebar-container {
      width: 54px !important;
    }
    .main-container {
      margin-left: 54px;
    }

    .submenu-title-noDropdown {
      padding: 0 !important;
      position: relative;

      .el-tooltip {
        padding: 0 !important;
        .svg-icon {
          // margin-left: 20px;
        }
      }
    }

    .el-submenu {
      overflow: hidden;

      &>.el-submenu__title {
        padding: 0 0 0 0.6rem;
        margin: 0.5rem;
        padding-left: 0!important;
        text-align: center;

        .svg-icon {
          margin-left: 2px;
          margin-right: 2px;
        }

        .el-submenu__icon-arrow {
          display: none;
        }
      }
    }

    .el-menu--collapse {
      .el-submenu {
        &>.el-submenu__title {
          &>span {
            height: 0;
            width: 0;
            overflow: hidden;
            visibility: hidden;
            display: inline-block;
          }
        }
      }
    }
  }

  .el-menu--collapse .el-menu .el-submenu {
    min-width: $sideBarWidth !important;
  }

  // mobile responsive
  .mobile {
    .main-container {
      margin-left: 0px;
    }

    .sidebar-container {
      transition: transform .28s;
      width: $sideBarWidth !important;
    }

    &.hideSidebar {
      .sidebar-container {
        pointer-events: none;
        transition-duration: 0.3s;
        transform: translate3d(-$sideBarWidth, 0, 0);
      }
    }
  }

  .withoutAnimation {

    .main-container,
    .sidebar-container {
      transition: none;
    }
  }
}

// when menu collapsed
.el-menu--vertical {
  &>.el-menu {
    .svg-icon {
      margin-right: 16px;
    }
  }

  .nest-menu .el-submenu>.el-submenu__title,
  .el-menu-item {
    &:hover {
      // you can use $subMenuHover
      background-color: $menuHover !important;
    }
  }

  // the scroll bar appears when the subMenu is too long
  >.el-menu--popup {
    max-height: 100vh;
    overflow-y: auto;

    &::-webkit-scrollbar-track-piece {
      background: #d3dce6;
    }

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background: #99a9bf;
      border-radius: 20px;
    }
  }
}
